package com.squapsource.project_euler;

public class Problem6 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		int maxNum = 100;
		double squareOfSums = Math.pow(sumOfRange(maxNum),2);
		double sumOfSquares = sumOfSquares(maxNum);
		System.out.printf("%f", (squareOfSums - sumOfSquares));

	}
	
	private static double sumOfSquares(int maxNum) {
		double sum =0;
		for (int i = 1; i <= maxNum; i++)
			sum += Math.pow(i, 2);
		return sum;
	}

	private static int sumOfRange(int highNum)
	{
		return highNum*(highNum+1)/2;
	}

}
